<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>22水平居中总结</title>
    <style>
        .box {
            width: 600px;
            height: 300px;
            background-color: pink;
            /* 
                内容 & 行内非替换元素居中显示
            */
            text-align: center;
        }

        /* 
            会继承
        */
        .son {
            height: 200px;
            width: 400px;
            background-color: skyblue;
        }
    </style>
</head>

<body>
    <div class="box">
        <span>我是一个span</span>
        <div class="son">我是一个div</div>
    </div>
</body>

</html>